var a = require("../../../@babel/runtime/helpers/defineProperty"), t = getApp();

Page({
    data: {
        activeName: 0,
        dataList: [ {
            isLoadMore: !0,
            page: 1,
            total_page: 0,
            list: []
        }, {
            isLoadMore: !0,
            page: 1,
            total_page: 0,
            list: []
        } ],
        titleArr: [ "代理套餐", "线上零售" ],
        isLoadMore: !0
    },
    onLoad: function(a) {
        this.getData();
    },
    getData: function(e) {
        var i = this;
        e && (this.data.activeName = e.detail.name);
        var s = this;
        if (this.data.dataList[s.data.activeName].list.length > 0) this.setData({
            isLoadMore: this.data.dataList[s.data.activeName].isLoadMore
        }); else {
            var d = t.getNetAddresss("plugin.new-retail.frontend.index.getSalesList");
            t._postNetWork({
                url: d,
                data: {
                    sales_type: Number(s.data.activeName) + 1
                },
                success: function(t) {
                    wx.hideLoading();
                    var e, d = t.data;
                    1 == d.result ? (s.setData((a(e = {}, "dataList[" + s.data.activeName + "].isLoadMore", !0), 
                    a(e, "dataList[" + s.data.activeName + "].total_page", d.data.last_page), a(e, "dataList[" + s.data.activeName + "].list", d.data.data), 
                    e)), console.log(i.data.dataList)) : wx.showToast({
                        title: d.msg,
                        duration: 1e3,
                        icon: "none"
                    });
                },
                fail: function(a) {
                    wx.hideLoading(), console.log(a.msg);
                }
            });
        }
    },
    _getMoreData: function() {
        var e = this;
        if (this.setData(a({}, "dataList[" + e.data.activeName + "].isLoadMore", !1)), !(this.data.dataList[this.data.activeName].page >= this.data.dataList[this.data.activeName].total_page)) {
            this.data.dataList[this.data.activeName].page = this.data.dataList[this.data.activeName].page + 1;
            var i = t.getNetAddresss("plugin.new-retail.frontend.index.getSalesList");
            i += "&page=" + this.data.dataList[this.data.activeName].page, t._getNetWork({
                url: i,
                data: {
                    sales_type: Number(e.data.activeName) + 1
                },
                success: function(t) {
                    var i = t.data;
                    if (1 == i.result) {
                        var s, d = i.data;
                        e.setData((a(s = {}, "dataList[" + e.data.activeName + "].isLoadMore", !0), a(s, "dataList[" + e.data.activeName + "].list", e.data.dataList[e.data.activeName].list.concat(d.data)), 
                        s));
                    } else {
                        var o;
                        e.setData((a(o = {}, "dataList[" + e.data.activeName + "].isLoadMore", !1), a(o, "dataList[" + e.data.activeName + "].page", e.data.dataList[e.data.activeName].page - 1), 
                        o));
                    }
                },
                fail: function(a) {
                    console.log(a);
                }
            });
        }
    },
    goLook: function(a) {
        var t = a.currentTarget.dataset.state, e = a.currentTarget.dataset.id;
        1 == t || 2 == t ? (0 == this.data.activeName && wx.navigateTo({
            url: "/packageH/newRetail/newRetail_agencyPackage/newRetail_agencyPackage?id=" + e
        }), 1 == this.data.activeName && wx.navigateTo({
            url: "/packageH/newRetail/newRetailRetailLink/newRetailRetailLink?id=" + e
        })) : wx.navigateTo({
            url: "/packageH/newRetail/newRetailSalesRecordDetail/newRetailSalesRecordDetail?id=" + e + "&mode=" + this.data.activeName
        });
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {}
});